//
//  IManager+ModuleShopManageModify.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-10-3.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleShopManageModify.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "GloableEngineService.h"
#import "RCFeedbackDataModel.h"

@implementation IManager(ModuleShopManageModify)

-(int64_t)requestSubmitShopModifyInfo:(NSString *)field withContent:(NSString *)content withDelegate:(id<IManagerDelegate>)delegate{
    
    NSString *shopID = [GloableEngineService sharedInstance].shopID;
    NSString *shopBduss = [GloableEngineService sharedInstance].shopBduss;
    
    if ([NSString stringIsNullOrEmpty:shopID] || [NSString stringIsNullOrEmpty:shopBduss]) {
        return kInvalidRequestId;
    }
    
    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    [postValue setObject:content forKey:@"content" withDefaultValue:@""];
    [postValue setObject:field forKey:@"field" withDefaultValue:@""];
    [postValue setObject:shopID forKey:@"shopid" withDefaultValue:@""];
    [postValue setObject:shopBduss forKey:@"shopbduss" withDefaultValue:@""];
    // 异步获取数据
    NSString *urlSuffix = kRCShopManageDetailModifyPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}

-(int64_t)requestSubmitShopAddressModifyInfo:(NSString *)field withContent:(NSString *)content withLat:(double)lat withLon:(double)lon withDelegate:(id<IManagerDelegate>)delegate{
    
    NSString *shopID = [GloableEngineService sharedInstance].shopID;
    NSString *shopBduss = [GloableEngineService sharedInstance].shopBduss;
    
    if ([NSString stringIsNullOrEmpty:shopID] || [NSString stringIsNullOrEmpty:shopBduss]) {
        return kInvalidRequestId;
    }
    
    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    [postValue setObject:content forKey:@"content" withDefaultValue:@""];
    [postValue setObject:field forKey:@"field" withDefaultValue:@""];
    [postValue setObject:shopID forKey:@"shopid" withDefaultValue:@""];
    [postValue setObject:shopBduss forKey:@"shopbduss" withDefaultValue:@""];
    [postValue setObject:[NSString stringWithFormat:@"%lf",lat] forKey:@"latitude" withDefaultValue:@""];
    [postValue setObject:[NSString stringWithFormat:@"%lf",lon] forKey:@"longitude" withDefaultValue:@""];
    // 异步获取数据
    NSString *urlSuffix = kRCShopManageDetailModifyPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}

@end
